package net.com.codeusa.net.packethandler;

import java.io.BufferedWriter;
import java.io.FileWriter;
import net.com.codeusa.*;
import net.com.codeusa.model.Player;
import net.com.codeusa.model.items.PlayerItems;
import net.com.codeusa.Server;
import net.com.codeusa.Engine;
import net.com.codeusa.model.combat.*;
import net.com.codeusa.util.Misc;

/**
 *
 * @author Codeusa <Codeusa@live.com>
 */

public class ItemOnItem implements Packet {

	/**
	 * Handles item on item packet.
	 * @param player p The player which the packet will be created for.
	 * @param packetId the packet id which is activated (Which handles this class)
	 * @param packetSize the amount of bytes being received for the packet.
	 */
	public void handlePacket(Player player, int packetId, int packetSize) {
		if (player == null)
			return;
		int usedWith = player.stream.readSignedWordBigEndian();
        	int itemUsed = player.stream.readSignedWordA();
		PlayerItems pi = new PlayerItems();

		/**
		 * GodSword Blade Making
		 * 
		 * Coded by Admin Mikee
		 */
		/*if (player.itemUsed == 11710 && player.usedWith == 11714 || player.itemUsed == 11710 && player.usedWith == 11712 || player.itemUsed == 11712 && player.usedWith == 11710 || player.itemUsed == 11712 && player.usedWith == 11710 || || player.itemUsed == 11714 && player.usedWith == 11710 || player.itemUsed == 11714 && player.usedWith == 11712) {
			if (Engine.playerItems.invItemCount(player, 11710) > 0 && Engine.playerItems.invItemCount(player, 11712) > 0 && Engine.playerItems.invItemCount(player, 11714) > 0) {
				player.getActionSender().sendMessage(player, "You use your master crafting skills to build a large GodSword Blade");
				Engine.playerItems.addItem(player, 11690, 1);
				Engine.playerItems.deleteItem(player, 11710, Engine.playerItems.getItemSlot(player, 11710), 1);
				Engine.playerItems.deleteItem(player, 11712, Engine.playerItems.getItemSlot(player, 11712), 1);
				Engine.playerItems.deleteItem(player, 11714, Engine.playerItems.getItemSlot(player, 11714), 1);
				return;
			} else {
				player.getActionSender().sendMessage(player, "You need all three shards to build a GodSword Blade.");
			}
		return;
		}*/
		System.out.println("used with: "+usedWith+" itemUsed: "+itemUsed);
	}

}

